home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / linux-2.0.34 / networking / alias.txt < prev    next >
Encoding:
Text File  |  1997-09-16  |  6.7 KB  |  197 lines

  1. NET_ALIAS device aliasing v0.5x
  2. ===============================
  3.   The main step taken in versions 0.40+ is the implementation of a
  4.   device aliasing mechanism that creates *actual* devices.
  5.   This development includes NET_ALIAS (generic aliasing) plus IP_ALIAS
  6.   (specific IP) support.
  7.   From version 0.50, dynamic configuration of max alias per device and
  8.   tx/rx stats for aliases added.
  9.   Also fixed inter-alias routing and arping problems.
  10.  
  11. Features
  12. --------
  13. o  ACTUAL alias devices created & inserted in dev chain
  14. o  AF_ independent: net_alias_type objects. Generic aliasing engine.
  15. o  AF_INET optimized
  16. o  hashed alias address lookup
  17. o  net_alias_type objs registration/unreg., module-ables.
  18. o  /proc/net/aliases & /proc/net/alias_types entries
  19. o  /proc/sys/net/core/net_alias_max entry (affects hash table size
  20.    also)
  21. o  tx/rx stats   
  22.  
  23.  
  24. o IP alias implementation: static or runtime module.
  25.  
  26. Usage (IP aliasing)
  27. -------------------
  28.   A very first step to test if you are running a net_alias-ed kernel
  29.   is to check /proc/net/aliases & /proc/net/alias_types entries:
  30.      # cat /proc/net/alias*
  31.  
  32.   For IP aliasing you must have IP_ALIAS support included by
  33.   static linking ('y' to CONFIG_IP_ALIAS? question), or runtime module
  34.   insertion ('m'):
  35.      # insmod /usr/src/linux/modules/ip_alias.o (2.0.xx) or
  36.      # modprobe ip_alias.o
  37.      
  38.      Also, dynamic loading is supported (kerneld).
  39.        You should have the following line in /etc/conf.modules (not needed
  40.        for newer modutils):
  41.        alias net_alias-2 ip_alias
  42.  
  43.   Module options
  44.   --------------
  45.   From 0.5x ip_alias module supports a new option ("no_sel" symbol).
  46.   If no_sel is set (default is 0), alias association (device selection) with
  47.   foreign addresses will be disabled.
  48.  
  49.     You will get:
  50.     - Faster operation by avoiding completely routing lookups. 
  51.       Due to the "logical nature" of aliasing, netdevice SELection can only be
  52.       done based on info from network layer. When packet dst address isn't 
  53.       one of my addresses, I query the routing table to see which netdevice
  54.       would be selected for packet _source_ address. This option avoids
  55.       doing so, and you must consider using it if you *only* have same-net
  56.       aliases (common usage).
  57.  
  58.     You will loose:
  59.     - Inter-alias routing
  60.     - Proxyarp over aliases
  61.  
  62.   To activate:
  63.     # insmod ip_alias.o no_sel=1  
  64.       or
  65.     # modprobe ip_alias.o no_sel=1
  66.       or
  67.     add the following line to /etc/conf.modules:
  68.       options ip_alias no_sel=1
  69.  
  70.  
  71. o Alias creation.
  72.   Alias creation is done by 'magic' iface naming: eg. to create a
  73.   200.1.1.1 alias for eth0 ...
  74.   
  75.     # ifconfig eth0:0 200.1.1.1  etc,etc....
  76.                    ~~ -> request alias #0 creation (if it not exists) for eth0
  77.     and routing stuff also ...
  78.     # route add -host 200.1.1.1 dev eth0:0  (if same IP network as
  79.                         main device)
  80.    
  81.     # route add -net 200.1.1.0 dev eth0:0   (if completely new network wanted
  82.                         for eth0:0)
  83.  
  84. o Alias deletion.
  85.   Also done by magic naming, eg:
  86.  
  87.     # ifconfig eth0:0-  0  (maybe any address)
  88.                    ~~~ -> will delete alias (note '-' after dev name)
  89.   alias device is closed before deletion, so all network stuff that
  90.   points to it (routes, arp entries, ...) will be released.
  91.                         
  92. o Alias (re-)configuring
  93.   Aliases *are* devices, so you configure and refer to them as usual (ifconfig,
  94.   route, etc).
  95.   
  96. o PROCfs entries
  97.   2 entries are added to help fetching alias runtime configuration:
  98.   a) /proc/net/alias_types
  99.      Will show you alias_types registered (ie. address families that
  100.      can be aliased).
  101.      eg. for IP aliasing with 1 alias configured:
  102.  
  103.      # cat /proc/net/alias_types
  104.      type    name            n_attach
  105.      2       ip              1      
  106.      
  107.   b) /proc/net/aliases
  108.      Will show aliased devices info, eg (same as above):
  109.  
  110.      # cat /proc/net/aliases
  111.      device           family address                                
  112.      eth0:0           2      200.1.1.1
  113.      
  114. o PROCfs dynamic configuration (from v0.50)
  115.   You can now change the max aliases per device limit via
  116.   /proc/sys/net/core/net_alias_max entry (default=256)
  117.      # cat /proc/sys/net/core/net_alias_max
  118.      256
  119.      # echo 1000 > /proc/sys/net/core/net_alias_max
  120.      # cat /proc/sys/net/core/net_alias_max
  121.      1000
  122.      # _
  123.           
  124.   With this funcionality you can disable net_alias creation from now on
  125.      # echo 0 > /proc/sys/net/core/net_alias_max
  126.  
  127.   The new aliasing limit is considered (grabbed) when creating the
  128.   FIRST alias for the main device.
  129.   Eg:
  130.      # echo 10 > /proc/sys/net/core/net_alias_max
  131.      # ifconfig eth0:0 xx.xx.xx.xx  (first alias creation for eth0,
  132.                                      eth0 will 'remember' max==10)
  133.      # echo 1000 > /proc/sys/net/core/net_alias_max
  134.      # ifconfig eth0:999 xx.xx.xx.xx
  135.      SIOCIFSADDR: No such device
  136.   Of course these semantics can be changed, please let me know.
  137.   
  138.   Configuration changes get logged as usual (klogd -> /var/log/messages)
  139.   
  140. o Alias devices rx/tx stats
  141.   Fake rx/tx stats are accounted:
  142.   - TX
  143.     When the packet is ``switched'' from logical alias device to
  144.     physical device, tx counter gets incremented.
  145.   - RX
  146.     When an incoming packet's address equals alias network device's addr it
  147.     gets ``switched'' from physical to logical device, rx counter gets
  148.     incr.
  149.     
  150.   Please NOTE that for ``same'' network alias devices you usually have
  151.   one net-route through physical device (eg. eth0), so output pkts
  152.   will NOT pass down via alias device (so, no tx++ will occur).
  153.   
  154.   Also NOTE that currently ifconfig does not handle the ``:'' of alias devices
  155.   names, a little patch solves the problem:
  156. --- ifconfig.c.dist    Tue Apr  4 17:58:32 1995
  157. +++ ifconfig.c    Fri Oct 25 13:11:23 1996
  158. @@ -243,7 +243,12 @@
  159.            bp++;
  160.        if(strncmp(bp,ifname,strlen(ifname))==0 && bp[strlen(ifname)]==':')
  161.        {
  162. -         bp=strchr(bp,':');
  163. +           /* 
  164. +         *     start bp at ifname end to prevent ':' ambiguity
  165. +         *     with alias devices (eg. eth0:0)
  166. +         *     
  167. +         */
  168. +        bp+=strlen(ifname);
  169.           bp++;
  170.           sscanf(bp,"%d %d %d %d %d %d %d %d %d %d %d",
  171.               &ife->stats.rx_packets,
  172.   
  173. Relationship with main device
  174. -----------------------------
  175.   - On main device closing, all aliases will be closed and freed.
  176.   - Each new alias created is inserted in dev_chain just before next
  177.     main device (aliases get 'stacked' after main_dev), eg:
  178.       lo->eth0->eth0:0->eth0:2->eth1->0
  179.     If eth0 is unregistered, all it aliases will also be:
  180.       lo->eth1->0
  181.  
  182. Contact
  183. -------
  184. Please e-mail me:
  185.    Juan Jose Ciarlante <irriga@impsat1.com.ar> or <jjciarla@raiz.uncu.edu.ar>
  186.    
  187. Acknowledments
  188. --------------
  189. Special thanks to Claudia for all her love an patience.
  190. Also thanks to Antonio Trevi~o <antonio@ecord.gov.ar> great human being 
  191. and un*x guru.
  192.  
  193. ; local variables:
  194. ; mode: indented-text
  195. ; mode: auto-fill
  196. ; end:
  197.